// Copyright (c) 2020 cgsdfc
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT

#include "pydsl/pydsl.h"

namespace pydsl {
const NoneType None;

DslScope::DslScope() {
  PYAST_INTERNAL_DCHECK(!g_arena_,
                        "There should only be one DslScope at a C++ scope");
  g_arena_ = pyast::Arena::CreateRaw();
}

DslScope::~DslScope() {
  PYAST_INTERNAL_DCHECK(g_arena_, "There should be one Arena to be deleted");
  g_arena_->Delete();
  g_arena_ = nullptr;
}

pyast::Arena* DslScope::current() {
  return g_arena_;
}

pyast::Arena* DslScope::g_arena_;

}  // namespace pydsl
